<?php
/**
 * Exigence
 * 
 * @author Chadi
 * @version 
 */
require_once 'Zend/Db/Table/Abstract.php';
class Application_Model_DbTable_Exigence extends Zend_Db_Table_Abstract
{
    /**
     * The default table name 
     */
    protected $_name = 'exigence';
    
function addExigencer ($id_produit, $code)
    {
        $data = array("id_produit" => $id_produit, "code" => $code);
        $this->insert($data);
    }
    
function updateExigence($id, $libelle, $description, $note)
	{
		$data = array (
		"libelle"=>$libelle,
		"description"=>$description ,
		"note"=>$note 
		);
		$this->update($data, 'id='.(int)$id);
	}
    
public function getExigence($id)
	{
		$db = Zend_Db_Table::getDefaultAdapter();
		$select = $db->select()
             ->from('exigence',array('*'))
             ->where('id_produit = ?',$id);
	
		$result = $db->fetchAll($select);
		//print_r($result);
    	//die();
    	return $result;
}

public function getUser($id)
	{
		$id=(int) $id;
		$row=$this->fetchRow('id='.$id);
		
		if(!$row)
		{
			throw new Exception("Could not find row $id");
		}
	return $row->toArray();
	}
function deleteExigence($id)
	{
		$this->delete('id='.(int)$id);	
	}

}